import axios from '../lib/axios.js'; // 导入axios库
import '../lib/jquery.js'; // 导入jQuery库


// 从 localStorage 中获取商品信息
const id = localStorage.getItem("goods_id");

// 获取商品信息
axios.get(`http://127.0.0.1:9000/goods/item/${id}`)
    .then(function (res) {
        if (res.data.code === 1) {
            const goods = res.data.info;
            $(".middleimg").attr("src", goods.img_big_logo);
            $(".title").text(goods.title);
            $(".old").text(goods.price);
            $(".discount").text(goods.sale_type);
            $(".curprice").text(goods.current_price);
            $(".desc").html(goods.goods_introduce);
        } else {
            alert(res.data.message);
        }
    })
    .catch(function (error) {
        console.error("Error fetching data:", error);
    })
    
